/* 封装和用户相关的请求 */

import axios from '@/utils/request'
/*
 * 用户登录
 */
export function login (mobile, code) {
  return axios({
    method: 'post',
    url: '/mp/v1_0/authorizations',
    data: {
      mobile,
      code
    }
  })
}

export function getFansCharts () {
  return axios({
    url: '/mp/v1_0/statistics/followers'
  })
}

/*
  获取用户信息
*/
export function getUserInfo () {
  return axios({
    method: 'get',
    url: '/mp/v1_0/user/profile'
  })
}

export function getUserFans (params) {
  return axios({
    method: 'get',
    url: '/mp/v1_0/followers',
    params
  })
}

export function updateAvatar (fd) {
  return axios({
    method: 'patch',
    url: '/mp/v1_0/user/photo',
    data: fd
  })
}

export function updateUserInfo (data) {
  return axios({
    method: 'patch',
    url: '/mp/v1_0/user/profile',
    data
  })
}
